import type { RouteRecordRaw, RouteLocationNormalized } from 'vue-router';

const verse: RouteRecordRaw[] = [
  {
    path: '/versecard',
    name: 'VerseCardPage',
    component: () => import('/@/views/verse/card'),
    meta: {
      title: '单卡',
    },
  },
  {
    path: '/versecard/:id',
    name: 'CardDetailPage',
    component: () => import('/@/views/verse/card-detail'),
    meta: {
      title: '单卡详情',
    },
    props: (router: RouteLocationNormalized) => {
      return {
        id: router.params.id ? String(router.params?.id) : 0,
      };
    },
  },
  {
    path: '/versedeck',
    name: 'VerseDeckPage',
    component: () => import('/@/views/verse/deck'),
    meta: {
      title: '套牌',
    },
  },
  {
    path: '/versedeck/:id',
    name: 'VerseDeckDetailPage',
    component: () => import('/@/views/verse/deck-detail'),
    meta: {
      title: '套牌详情',
    },
    props: (router: RouteLocationNormalized) => {
      return {
        id: router.params.id ? String(router.params?.id) : 0,
        share: router.query.share || '',
      };
    },
  },
  {
    path: '/versecreate/:id?',
    name: 'DeckCreatePage',
    component: () => import('/@/views/verse/deck-create'),
    meta: {
      title: '创建套牌',
    },
    props: (router: RouteLocationNormalized) => {
      return {
        id: router.params.id ? String(router.params?.id) : '',
      };
    },
  },
  {
    path: '/versedeckcard/:type',
    name: 'DeckCardPage',
    component: () => import('/@/views/verse/deck-card'),
    meta: {
      title: '选择卡牌',
    },
    props: (router: RouteLocationNormalized) => {
      return {
        type: router.params.type,
      };
    },
  },
];

export default verse;
